package com.hbm.usercenter.adpter;

import android.content.Intent;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;

import com.hbm.usercenter.activity.DetailActivity;
import com.hbm.usercenter.base.BaseHolder;
import com.hbm.usercenter.base.SuperBaseAdapter;
import com.hbm.usercenter.bean.OrderBean;
import com.hbm.usercenter.holder.OrderHolder;
import com.hbm.usercenter.utils.UIUtils;

import java.util.List;

/**
 * Created by mjshe on 2017/6/29.
 */

public class DealOrderAdapter extends SuperBaseAdapter<OrderBean.RowsBean> {
    public DealOrderAdapter(AbsListView absListView, List<OrderBean.RowsBean> datas) {
        super(absListView, datas);
    }

    @Override
    protected BaseHolder<OrderBean.RowsBean> getSpecialHolder(int position) {
        return new OrderHolder();
    }

    @Override
    public void onNormalItemClick(AdapterView<?> parent, View view, int position, long id) {
        OrderBean.RowsBean rowsBean = mDataSource.get(position);
        String list_id = rowsBean.id;
        gotoDetailActivity(list_id);
    }

    private void gotoDetailActivity(String id) {
        Intent intent = new Intent(UIUtils.getContext(), DetailActivity.class);
        intent.putExtra(DetailActivity.ID_DATA, id);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        UIUtils.getContext().startActivity(intent);
    }
}
